package com.xiaoKe.zhonghzu.global.tool;

import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.PrettyFormatStrategy;


public class Logger {
    public static void init(String tag, Boolean isDebug) {
        TAG = tag;
        IS_DEBUG = isDebug;
        //可以不设置
        FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
                .showThreadInfo(false)  // (Optional) Whether toFragment show thread info or not. Default true
                .methodCount(0)         // (Optional) How many method line toFragment show. Default 2
                .methodOffset(7)        // (Optional) Hides internal method calls up toFragment offset. Default 5
//                .logStrategy(customLog) // (Optional) Changes the log strategy toFragment print out. Default LogCat
                .tag(tag)   // (Optional) Global tag for every log. Default PRETTY_LOGGER
                .build();
        com.orhanobut.logger.Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
    }

    private static String TAG = "jingNa";
    private static Boolean IS_DEBUG = false;

    public static void json(String msg) {
        if (IS_DEBUG) {
            com.orhanobut.logger.Logger.json(msg);
        }
    }

    public static void e(String msg) {
        if (IS_DEBUG) {
            com.orhanobut.logger.Logger.e(msg);
        }
    }

    public static void i(String msg) {
        if (IS_DEBUG) {
            com.orhanobut.logger.Logger.i(msg);
        }
    }
}
